package com.turing.mission.commandLine;

import com.turing.mission.mapper.MissionMapper;
import org.springframework.boot.CommandLineRunner;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ZSetOperations;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Component
public class InitRedis implements CommandLineRunner {

    @Resource
    private MissionMapper missionMapper;
    @Resource
    private RedisTemplate redisTemplate;

    @Override
    public void run(String... args) throws Exception {
//       List<Map> list = missionMapper.listMission();
//        ZSetOperations valueOps = redisTemplate.opsForZSet();
//        for (Map map : list) {
//            valueOps.add("missionComments", map.get("id"), (Long) map.get("counts"));
//        }
    }
}
